import asyncio, functools

def retry(times=3, delay=1):
    def decorator(func):
        @functools.wraps(func)
        async def wrapper(*args, **kwargs):
            for i in range(times):
                try:
                    return await func(*args, **kwargs)
                except Exception as e:
                    print(f"[Retry] {i+1}/{times} {e}")
                    if i == times - 1:
                        raise
                    await asyncio.sleep(delay)
        return wrapper
    return decorator
